<template>
	<view class="category bf h100v" :class="(tcyhqshow||tcggshow)&&'bgfix'">
		<!-- <tips></tips> -->
		<view class="posi-f l0 w100">
			<uni-nav-bar id='uninavbar' :uropcity="1" :uriconopcity='0' :fixed='false' :ispr='false' :border='false' :statusBar="true"
			 leftcn='iconjiayuan' rightcn='iconsousuo1' :custommore="true" @on-more='onmore' :title="storeInfo.name||''">
			</uni-nav-bar>
			<view class="header p03 bf" :style="{zIndex: showShopInfo?'2001':''}">
				<view class="header-bd f-c-xc">
					<view class="f-bt">
						<view class="f-1 f-y-c">
							<!-- <text class="iconfont iconditu1 mr10" :style="{color:tColor}"></text> -->
							<view v-if="sjxx.shopData" @click="system.defaultStore==2&&go({t:system.decorationModel == 3?3:1,url:'select?page=goods&id='+storeInfo.id})"
							 class="f-1" style="padding-right: 20rpx;">
								<view class="t-o-e f-y-c f32 wei">
									<text>{{storeInfo.name}}</text>
									<text v-if="system.defaultStore==2" class="iconfont iconright ml10 nowei c3"></text>
								</view>
								<view class="f-y-c c9 mt5">
									<!-- <text class="iconfont iconditu1 f28 mr10"></text> -->
									<text class="nowei" v-if="storeInfo.distance">距离您{{storeInfo.distance}}</text>
								</view>
							</view>
						</view>
						<view v-if="ModeArr.length" class="f-row ml30">
							<view v-if="ModeArr.length" class="f-c buytype" @click="changeBuyType">
								<view v-for="(v,i) in ModeArr" :key='i' class="type bs30 f-c f24 c9" :class="{'atype cf f28':buyType==v.value}"
								 :style="{background1:buyType==v.value?tColor:''}">{{v.name}}</view>
							</view>
							<view v-else class="bf6 f-c myicon bsf">
								<text @click="go({t:2,url:'/yb_cy/my/index'})" class="iconfont iconwd c3"></text>
							</view>
						</view>
					</view>
					<view class="f-bt mt20 c9">
						<view class="f-1 f-y-c f24">
							<text class="iconfont icontishi mr15" :style="{color:tColor}"></text>
							<text class="t-o-e">{{sjxx.moreSet.notic}}</text>
						</view>
						<view @click="showShopInfo=!showShopInfo" class="f22 ml20 f-y-c">更多
							<text class='iconfont icondown f22 ml5 c9'></text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="h100" :style="{paddingTop:`${pageHeight.topH}px`}">
			<view v-show="sIndex==0" class="bodyer bf">
				<mg-swiper :co='lbswiper' u='rpx' :color='tColor'></mg-swiper>
				<block v-if="goodsList.length>0">
					<view class="m20 b-s-1 p02 bs20">
						<mg-cell cname='p20 f30' last="1" :btt="'商家推荐'||sjxx.orderSet.data.recommend" :arrow="0"></mg-cell>
						<goods type='2' addtype='2' :outin='outin' @dec='dec' @add='add' :d-list='goodsList'></goods>
					</view>
				</block>
			</view>
			<view class="category-c f-row">
				<!-- 左边导航 -->
				<scroll-view scroll-y class="left-c" scroll-with-animation="true" :scroll-into-view="lsiv" :style="{paddingBottom: leftpb}">
					<view class="title-c" :id="'l'+i" :class="{'onSelected':sIndex == i}" v-for="(v,i) in catrgoryList" :key="i"
					 @click="choose(i)">
						<view v-if='sIndex == i' class="title-b" :style='{background:tColor}'></view>
						<view v-if='v.isRequire' class="title-bx cf5f f18 nowei">必选</view>
						<view class="title-n f-c-xc" :class="{'ysyj':i==sIndex+1,'yxyj':i==sIndex-1}">
							<block v-if="sjxx.categorySet.display==3">
								<view class="f-y-e">
									<view class="title-img">
										<mg-img m='aspectFit' :src="v.icon" />
									</view>
									<text>{{lfName(v.name)}}</text>
								</view>
								<text class="mt15 t-o-e" v-if="lsName(v.name)">{{lsName(v.name)}}</text>
							</block>
							<block v-else-if="sjxx.categorySet.display==2">
								<view class="f-x-c">
									<view class="title-img">
										<mg-img m='aspectFit' :src="v.icon" />
									</view>
								</view>
								<text class="mt15 t-c t-o-e">{{v.name}}</text>
							</block>
							<block v-else>
								<view class="f-x-c">
									<text class="t-o-e2">{{v.name}}</text>
								</view>
							</block>
						</view>
					</view>
				</scroll-view>
				<scroll-view lower-threshold='100' scroll-y class="f-g-1 right-c" :scroll-into-view="rsiv" @scroll="myscroll"
				 :style="{paddingBottom: rightpb}">
					<block v-for="(pv,pi) in catrgoryList" :key="pv.id">
						<view class="c-item" :id="'r'+pi">
							<view class="c-title">{{pv.name}}</view>
							<view v-for="(co,i) in pv.goods" :key="i" class='conw2 f-row p2' :class="{conw2mb:pi==catrgoryList.length-1&&i==pv.goods.length-1}">
								<view @click='goodinfo' class="f-g-0 bf6 left bs5 p-r">
									<mg-img cname='wh' :src='co.icon' />
									<view v-if='outin==1?co.outStock<=0:co.inStock<=0' class="p-a ysq f-c b0 cf w100 f26">已售罄</view>
									<!-- <view v-if="co.labelName" class="p-a ppbq f20 cf" :style="{background:co.labelColor}">{{co.labelName}}</view> -->
								</view>
								<view class="f-g-1 ml20 f24 c9">
									<view class="f30 t-o-e c0">{{co.name}}</view>
									<view v-if="co.labelName" class="mt10">
										<text class='text-btnf f22 mr10 p-3-10 bs5' :style="{background:`rgba(${cTR(co.labelColor)},0.1)`,color:co.labelColor,}">{{co.labelName}}</text>
									</view>
									<view v-if="co.body" class="mt10 t-o-e2 f22">{{co.body}}</view>
									<!-- <view v-if="orderset.sales==1&&co.salesNum>0" class="mt10 f-raw">
										<text class="mr30">销量 {{co.salesNum}}</text>
									</view> -->
									<!-- <view class="mt10 f-row">
										<view class="vipl f-y-c">
											<view>{{sl+co.price}}</view>
										</view>
										<view class="vipr f-y-c">VIP</view>
									</view> -->
									<view class='f-x-bt mt10'>
										<view class='f-g-1 wei t-o-e c3 f36'><text class="f30 mr5">{{sl}}</text>{{co.price}}
											<!-- <text v-if="1==1" class="nowei c9 f24">/{{co.unit||'个'}}</text>
											<text v-if="1==1" class="t-d-l nowei ml10 c9 f24">{{sl+co.price}}</text> -->
										</view>
										<view v-if="(co.isSpecs==1||co.isMaterial==1||co.isAttr==1)" @click.stop="add({addwz:1,g:co})" class="f-g-0 cartggc f-c">
											<view class='text-btnf f24 f-c ggc' :style="{background:isClose?tColor:'#ccc'}">
												<text>选 择</text>
												<text v-if='co.num>0' class="dot f-c" :style="{background:isClose?tColor:'#ccc'}">{{co.num}}</text>
											</view>
										</view>
										<view v-else class="f-g-0 f-bt">
											<view v-if="co.num>0" class="reducecon active f-y-c">
												<view @click.stop="dec({addwz:1,g:co})" class="cartc f-c">
													<button class="cartdec" :style="{borderColor:isClose?tColor:'#ccc'}">
														<view class="cartdecab" :style="{background:isClose?tColor:'#ccc'}"></view>
													</button>
												</view>
												<text class="f36 ma c0">{{co.num}}</text>
											</view>
											<view @click.stop="add({addwz:1,g:co})" class="cartc f-c">
												<button class="cartadd" :style="{background:isClose?tColor:'#ccc'}"></button>
											</view>
										</view>
									</view>
									<view v-if="co.maxNum>0||co.minNum>1">
										<text v-if="co.minNum>1" class="cf5f mr20">{{co.minNum}}份起售</text>
										<text v-if="co.maxNum>0" class="cf5f">限{{co.maxNum}}份</text>
									</view>
								</view>
							</view>
						</view>
					</block>
				</scroll-view>
			</view>
		</view>
		<!-- <tcyhq @close='tcyhqshow=false' :co='tcCoupon' v-model="tcyhqshow" :color='tColor'></tcyhq> -->
		<!-- <tcgg :list='tcggList' v-model="tcggshow"></tcgg> -->
		<goods-car :show.sync='showCar' :carBtm="system.outTabbar!=1?isIpx?'155':'115':'0'" :carlistPab="system.outTabbar!=1?isIpx?'265':'225':'110'"
		 :buytype='buyType' v-if='sjxx.shopData' :sjxx='sjxx' @dec='dec' @add='add' @celar='celarCar' :goods-list='catrgoryList'
		 :startmoney='startMoney'></goods-car>
		<store-info v-if='sjxx.shopData' v-model="showShopInfo" :co='sjxx'></store-info>
		<spec :outin='outin' @add='add' :co='goodsInfo' :storeid='storeInfo.id' v-model="showGg"></spec>
		<tab-bar></tab-bar>
		<load v-if="showloading"></load>
		<load type="2" v-model="showjz"></load>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
		mapActions
	} from 'vuex'
	import uniNavBar from "@/components/third/uni-nav-bar.vue"
	import goods from '@/components/goods/index.vue'
	import goodsCar from '@/components/goods/goods-car.vue'
	import spec from '@/components/goods/spec.vue'
	import load from '@/components/common/load.vue'
	import mgPopup from '@/components/common/popup.vue'
	import mgModal from '@/components/common/modal.vue'
	import jzz from '@/components/common/jzz.vue';
	import utils from '@/common/utils.js'
	import tips from '@/components/common/tips.vue'
	import MgSwiper from '@/components/common/functionCmp/swiper.vue'
	import tcyhq from '@/components/template/tcyhq.vue'
	import tcgg from '@/components/template/tcgg.vue'
	import storeInfo from '@/components/goods/store/store-info.vue'
	import {
		utilMixins
	} from "@/common/util-mixins.js"
	import {
		getDw
	} from "@/common/wechat-util.js"
	export default {
		components: {
			uniNavBar,
			goods,
			goodsCar,
			spec,
			load,
			mgPopup,
			mgModal,
			jzz,
			tips,
			MgSwiper,
			tcyhq,
			tcgg,
			storeInfo,
		},
		data() {
			return {
				showloading: true,
				catrgoryList: [],
				goodsList: [],
				sIndex: 0,
				// isscroll: false,
				rsiv: '', //右侧滑值
				lsiv: '', //左侧滑值
				showGg: false,
				buyType: 2,
				showShopInfo: false, //更多门店信息
				outin: '1', //1out2店内
				goodsInfo: {}, //规格弹窗信息
				showjz: false,
				tcyhqshow: false,
				tcCoupon: {},
				tcggshow: false,
				tcggList: [],
				showCar: false,
				startMoney: '',
			}
		},
		mixins: [utilMixins],
		async onLoad(options) {
			// return
			this.storeId = utils.getOptions(options, {
				key: 'storeId',
				q1: this.storeInfo.id,
			}) || ''
			console.log(this.storeId)
			this.query = options
			await this.getLoginInfo({
				inviteId: options.userId
			})
			this.getDw()
			this.getSystem()
			this.getLayout()
			// console.log('%c options ',
			// 	'color: white; background-color: #f44444', options);
		},
		onShow() {
			//为了跳转支付页面主动返回此页面情况
			// if (this.storeInfo.id && uni.getStorageSync('payPage')) {
			// 	this.refreshInfo()
			// 	console.log('从支付页返回')
			// }
			// console.log('goods onShow', this.storeInfo.id)
		},
		onHide() {
			this.startMoney = ''
			// console.log('onHide')
		},
		computed: {
			...mapState(['sjxx']),
			...mapState({
				scarList: state => state.scarList.data || [],
				storeInfo: state => state.config.storeInfo,
			}),
			pageHeight() {
				if (!getApp().sgheight) {
					let h = uni.getSystemInfoSync(),
						topH = +(h.statusBarHeight + 44 + uni.upx2px(
							178)).toFixed(2)
					getApp().sgheight = {
						// mainH: +(h.windowHeight - topH).toFixed(2),
						topH,
					}
				}
				return getApp().sgheight
			},
			lbswiper() {
				return {
					class: 'mt10 mb20',
					swiper: this.sjxx.moreSet && this.sjxx.moreSet.orderMedia.map(v => ({
						url: v
					})),
					duration: '',
					mode: '',
					height: '260',
					radius: '8',
					auto: true,
					interval: 5,
				}
			},
			ModeArr() {
				let arr = []
				if (this.sjxx.moreSet) {
					if (this.sjxx.moreSet.distributionSupport.length == 2) {
						arr = [{
							name: this.sjxx.moreSet.selfName,
							value: '2',
						}, {
							name: this.sjxx.moreSet.outName,
							value: '1',
						}] //1外卖2自取
						if (this.sjxx.moreSet.auto == 2) { //2外卖优先
							arr.reverse()
						}
						this.buyType = arr[0].value
						if (this.query.type) {
							this.buyType = this.query.type
						}
					} else if (this.sjxx.moreSet.distributionSupport.find(v => v == 1)) {
						this.buyType = 1
					} else if (this.sjxx.moreSet.distributionSupport.find(v => v == 2)) {
						this.buyType = 2
					}
				}
				return arr
			},
			isClose() {
				return this.sjxx.shopData && (this.sjxx.shopData.storeOpen == 1 || this.sjxx.shopData.storeOpen == 2 && this.sjxx.moreSet
					.status == 1)
			},
			cshow() {
				return this.scarList.length > 0
			},
			leftpb() {
				if (this.system.outTabbar == 1) {
					return this.cshow ? '305rpx' : '115rpx'
				} else {
					return this.cshow ? '260rpx' : '115rpx'
				}
			},
			rightpb() {
				if (this.system.outTabbar == 1) {
					return this.cshow ? '230rpx' : '115rpx'
				} else {
					return this.cshow ? '230rpx' : '115rpx'
				}
			},
		},
		// watch: {},
		methods: {
			...mapActions(["getSjxx", "getConfig", "supdCar", "getMycar"]),
			...mapMutations(["setScarList"]),
			async getDw() {
				let lc = await getDw({
					t: 0
				})
				this.init();
				// console.log(this.pageHeight)
			},
			//切换门店触发
			changeStore(v) {
				this.storeId = v.id
				this.refreshInfo()
				console.log('changeStore', v)
			},
			async refreshInfo() {
				this.sIndex = 0
				this.rsiv = 'r0'
				this.setScarList({})
				this.init()
			},
			async init(type = 1) {
				let lc = getApp().globalData.gdlocation
				// console.time()
				await this.getSjxx({
					storeId: this.storeId,
					// item: this.outin,
					lat: lc.latitude,
					lng: lc.longitude,
				})
				await this.getMycar({
					storeId: this.sjxx.shopData.id
				})
				// console.timeEnd()
				this.storeId = this.sjxx.shopData.id
				// this.dates = new Date().getTime()
				this.goodsList = utils.deepCopy(this.sjxx.recommendData)
				this.catrgoryList = utils.deepCopy(this.sjxx.data)
				this.showloading = false
				// console.log(this.sjxx.data, this.goodsList)
				//购物车
				// console.time('gwc')
				for (let c = 0; c < this.scarList.length; c++) {
					for (let i = 0; i < this.catrgoryList.length; i++) {
						for (let j = 0; j < this.catrgoryList[i].goods.length; j++) {
							if (this.catrgoryList[i].goods[j].id == this.scarList[c].goodsId) {
								this.catrgoryList[i].goods[j].num = +this.catrgoryList[i].goods[j].num + (+this.scarList[c].num)
							}
						}
					}
					for (let i = 0; i < this.goodsList.length; i++) {
						if (this.goodsList[i].id == this.scarList[c].goodsId) {
							this.goodsList[i].num = +this.goodsList[i].num + (+this.scarList[c].num)
						}
					}
				}
				// console.timeEnd('gwc')
				// let num = 0
				// this.catrgoryList.forEach(v => {
				// 	num += v.goods.length
				// })
				// console.log(num)
				this.$nextTick(() => {
					// console.log(this.dates, new Date().getTime() - this.dates)
					// uni.hideLoading()
					setTimeout(() => {
						this.getHeightList();
					}, 100)
				})
				this.getConfig({
					key: 'storeInfo',
					data: {
						id: this.sjxx.shopData.id,
						name: this.sjxx.shopData.name,
						distance: this.sjxx.shopData.distance + 'km'
					}
				})
				// console.log(data.map(v=>v.goods))
			},
			//第一种样式
			getHeightList() {
				let selectorQuery = uni.createSelectorQuery();
				// selectorQuery.select('#main').boundingClientRect((rects) => {
				// 	this.pageHeight.mainB = rects.top - this.pageHeight.topH;
				// 	this.isscroll = this.pageHeight.mainB <= 5
				// 	console.log(rects, this.pageHeight.mainB)
				// });
				selectorQuery.selectAll('.c-item').boundingClientRect((rects) => {
					let arr = [],
						h = 0
					rects.forEach(v => {
						h += v.height
						arr.push(h)
					})
					this.right_height = arr;
					// console.log(this.dates, new Date().getTime() - this.dates)
					// console.log('rects', rects, this.right_height)
				}).exec();
			},
			choose(index) {
				// if (!this.isscroll) {
				// 	this.isscroll = true
				// 	uni.pageScrollTo({
				// 		scrollTop: this.pageHeight.mainB,
				// 		duration: 0,
				// 	})
				// }
				if (this.sIndex == index) return
				this.sIndex = index;
				this.noscroll = true
				this.lsiv = `l${index-3}`
				this.rsiv = `r${index}`
				setTimeout(() => {
					this.noscroll = false
				}, 500)
			},
			myscroll(e) {
				// console.log('myscroll', this.noscroll, e)
				//引入节流	
				if (this.noscroll) return
				let scroll_top = e.detail.scrollTop;
				//判断当前的scrollTop在哪个区间内;
				for (let i = 0; i < this.right_height.length; i++) {
					if (scroll_top < this.right_height[0]) {
						this.sIndex = 0
						this.lsiv = `l0`
					} else if (scroll_top >= this.right_height[i - 1] && scroll_top < this.right_height[i]) {
						this.sIndex = i
						this.lsiv = `l${i-3}`
						this.rsiv = '' //这里不设置空导致siv不触发
						break
					}
				}
				// let active_index = this.right_height.findIndex((value, index, arr) => value <= scroll_top && scroll_top < arr[
				// 	index + 1]);
			},
			refreshList() {
				let carr = this.carList
				let arr = this.catrgoryList
				for (let i = 0, len = arr.length; i < len; i++) {
					for (let j = 0, len = arr[i].goods.length; j < len; j++) {
						arr[i].goods[j].num = 0
						for (let c = 0; c < carr.length; c++) {
							if (arr[i].goods[j].goodsId == carr[c].goodsId) {
								arr[i].goods[j].num += carr[c].num
							}
						}
					}
				}
				let garr = this.goodsList
				for (let i = 0, len = garr.length; i < len; i++) {
					garr[i].num = 0
					for (let c = 0; c < carr.length; c++) {
						if (garr[i].goodsId == carr[c].goodsId) {
							garr[i].num += carr[c].num
						}
					}
				}
			},
			//
			async updList(p) {
				// console.log('updList', p)
				// return
				try {
					let res = await this.supdCar(p.e.addwz == '1' ? p.e.g.ggnum ? { //选规格加
						storeId: this.storeId,
						type: p.type,
						goodsId: p.e.g.id,
						groupId: p.e.g.groupId || '',
						material: p.e.g.material || [],
						attribute: p.e.g.attribute || '',
						num: p.e.g.ggnum,
					} : { //列表加
						storeId: this.storeId,
						type: p.type,
						goodsId: p.e.g.id,
					} : { //购物车加
						storeId: this.storeId,
						type: p.type,
						goodsId: p.e.g.goodsId,
						id: p.e.g.id,
					})
					// let carRes
					// if (e.updType == 1) {
					// 	carRes = await this.addCar({
					// 		g: e.g,
					// 		gnum: res,
					// 	})
					// } else {
					// 	carRes = await this.decCar({
					// 		g: e.g,
					// 		gnum: res,
					// 	})
					// }
					// console.log(res)
					//return
					//改变商品列表里的数量
					let arr = this.catrgoryList
					for (let i = 0, len = arr.length; i < len; i++) {
						for (let j = 0, len = arr[i].goods.length; j < len; j++) {
							if (p.e.addwz == '1' && arr[i].goods[j].id == p.e.g.id) {
								arr[i].goods[j].num = res
							} else if (p.e.addwz == '2' && arr[i].goods[j].id == p.e.g.goodsId) {
								arr[i].goods[j].num = res
							}
						}
					}
					//改变推荐商品里的数量
					let garr = this.goodsList
					for (let i = 0, len = garr.length; i < len; i++) {
						if (p.e.addwz == '1' && garr[i].id == p.e.g.id) {
							garr[i].num = res
						} else if (p.e.addwz == '2' && garr[i].id == p.e.g.goodsId) {
							garr[i].num = res
						}
					}
					this.showjz = false
				} catch (e) {
					this.showjz = false
					console.log(e)
				}
			},
			async dec(e) {
				if (this.isClose) {
					this.showjz = true
					this.updList({
						type: 2,
						e,
					})
				}
				// let dec = await this.decCar({
				// 	g: g,
				// 	outin: this.outin
				// })
				// //改变商品列表里的数量
				// let arr = this.catrgoryList
				// for (let i = 0, len = arr.length; i < len; i++) {
				// 	for (let j = 0, len = arr[i].goods.length; j < len; j++) {
				// 		if (arr[i].goods[j].goodsId == g.goodsId) {
				// 			arr[i].goods[j].num -= dec.gnum
				// 		}
				// 	}
				// }
				// //改变推荐商品里的数量
				// let garr = this.goodsList
				// for (let i = 0, len = garr.length; i < len; i++) {
				// 	if (garr[i].goodsId == g.goodsId) {
				// 		garr[i].num -= dec.gnum
				// 	}
				// }
				// console.log('listdec', g)
			},
			async add(e) {
				// console.log('listadd', e, )
				// return
				if (this.isClose) {
					this.showjz = true
					if ((e.g.isSpecs != 1 && e.g.isMaterial != 1 && e.g.isAttr != 1) || e.g.hasOwnProperty('groupId')) {
						this.updList({
							type: 1,
							e,
						})
					} else {
						this.showGg = true
						this.goodsInfo = e.g
						this.showjz = false
					}
				}
				// //add是公用的，g的数据字段来判断是弹窗还是加购物车(1.普通没有规格和加料，2.有规格或者加料)
				// if ((e.g.isSpec != 1 && e.g.isMaterial != 1 && e.g.isAttribute != 1) || e.g.hasOwnProperty('groupId')) {
				// 	let add = await this.addCar({
				// 		g: e.g,
				// 		outin: this.outin
				// 	})
				// 	// console.log(add)
				// 	if (add.isxg) return
				// 	//return
				// 	//改变商品列表里的数量
				// 	let arr = this.catrgoryList
				// 	for (let i = 0, len = arr.length; i < len; i++) {
				// 		for (let j = 0, len = arr[i].goods.length; j < len; j++) {
				// 			if (arr[i].goods[j].goodsId == e.g.goodsId) {
				// 				arr[i].goods[j].num += add.gnum
				// 			}
				// 		}
				// 	}
				// 	//改变推荐商品里的数量
				// 	let garr = this.goodsList
				// 	for (let i = 0, len = garr.length; i < len; i++) {
				// 		if (garr[i].goodsId == e.g.goodsId) {
				// 			garr[i].num += add.gnum
				// 		}
				// 	}
				// 	// #ifdef H5 || MP-WEIXIN
				// 	e.e && this.addShopCar(e.e, this.getImgS(e.g.icon))
				// 	// #endif
				// } else {
				// 	this.showGg = true
				// 	this.goodsInfo = e.g
				// }
			},
			celarCar(e) {
				let arr = this.catrgoryList
				for (let i = 0, len = arr.length; i < len; i++) {
					for (let j = 0, len = arr[i].goods.length; j < len; j++) {
						arr[i].goods[j].num = 0
					}
				}
				//改变推荐商品里的数量
				let garr = this.goodsList
				for (let i = 0, len = garr.length; i < len; i++) {
					garr[i].num = 0
				}
			},
			changeBuyType() {
				this.buyType = this.buyType == 1 ? 2 : 1
			},
			trigger(e) {
				this.go({
					t: e.index > 1 ? 1 : 2,
					url: e.item.url
				})
				console.log(e);
			},
			lfName(v) {
				let f = v.substr(0, 2),
					s = v.substr(2, 4)
				return v.substr(0, 2)
			},
			lsName(v) {
				return v.substr(2, 5)
			},
			onmore() {},
			//页面滚动方法
			// goTop() {
			// 	uni.pageScrollTo({
			// 		scrollTop: this.other_height,
			// 		duration: 100
			// 	});
			// },
		},
		// onPageScroll(e) {
		// 	console.log(this.isscroll)
		// 	if (!this.isscroll && this.pageHeight.mainB - e.scrollTop <= 2) {
		// 		this.isscroll = true
		// 		console.log('111')
		// 	} else if (e.scrollTop < this.pageHeight.mainB) {
		// 		this.isscroll = false
		// 		console.log('222')
		// 	}
		// 	console.log('pscroll', e.scrollTop)
		// },
		onShareAppMessage() {
			let p = `yb_cy/shop/goods?storeId=${this.storeId}&userId=${this.uId}`
			return this.util.mpShare({
				t: this.sjxx.storeInfo.name,
				p,
			})
		},
	}
</script>
<style scoped lang="scss">
	@import './goods.scss';
</style>
